<?php

namespace app\popo\model;

use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;

class Dish extends BaseModel
{
    protected $table = "dish";
    protected $guarded = array("id");

    protected $casts = [
        self::CREATED_AT => 'datetime:Y-m-d H:i:s',
        self::UPDATED_AT => 'datetime:Y-m-d H:i:s',
    ];

    protected bool $auto_fill_create_user = true;
    protected bool $auto_fill_update_user = true;
    public function category(): BelongsTo
    {
        return $this->belongsTo(Category::class, "category_id");
    }

    public function flavors(): HasMany
    {
        return $this->hasMany(DishFlavor::class, "dish_id");
    }
}